package br.org.pmjn.patrimonio.core.application.impl;

import java.util.List;

import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import br.org.pmjn.patrimonio.core.application.BemApplication;
import br.org.pmjn.patrimonio.core.domain.bem.Bem;
import br.org.pmjn.patrimonio.core.domain.bem.BemRepository;

@Transactional(propagation=Propagation.REQUIRED)
public class BemApplicationImpl implements BemApplication {

	private BemRepository bemRepository;

	public BemApplicationImpl(BemRepository bemRepository) {
		super();
		this.bemRepository = bemRepository;
	}

	@Override
	public void salvar(Bem bem) {
		bemRepository.salvar(bem);
	}

	@Override
	public void atualizar(Bem bem) {
		bemRepository.atualizar(bem);
	}

	@Override
	public Bem localizarPorCodigo(Integer codigo) {
		return bemRepository.localizarPorCodigo(codigo);
	}

	@Override
	public List<Bem> listarTodos() {
		return bemRepository.listarTodos();
	}

}
